package com.dengqi.mymodule.activity.network.module;

import com.dengqi.mymodule.activity.network.bean.AccountBusinessBean;
import com.dengqi.mymodule.activity.network.bean.AccountBean;
import com.module.retrofit.bean.ResponseBean;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;

/**
 * @Author: dengqi
 * @CreateDate: 2020-10-15 20:06
 * @Description: 账号模块：账号登录、获取账号类型、修改账号密码、账号登出
 */
public interface AccountContract {

    interface LoginView{
        String getAccount();
        String getPassWord();
        String getCaptcha();
        String getLoginType();
        void onLogin(AccountBean result);
    }

    interface AccountTypeView{
        void onGetAccountType(AccountBusinessBean result);
    }

    interface EditPasswordView{
        String getPhone();
        String getPassWord();
        String getRePassWord();
        String getCaptcha();
        void onEditPassword();
    }

    interface LogoutView{
        void onLogout();
    }

    interface Presenter{
        void login(LoginView view);
        void getAccountType(AccountTypeView view);
        void login2(LoginView loginView, AccountTypeView accountTypeView);
        void editPassword(EditPasswordView view);
        void logout(LogoutView view);
    }

    interface Model{
        //登录
        @FormUrlEncoded
        @POST("https://api.900sui.cn/v1/u/user/login")
        Observable<ResponseBean<AccountBean>> login(@FieldMap Map<String, String> params);

        //获取账户类型
        @GET("https://api.900sui.cn/v1/bus/busfront/getUserType")
        Observable<ResponseBean<AccountBusinessBean>> getAccountType();

        //修改密码
        @FormUrlEncoded
        @POST("https://api.900sui.cn/v1/u/user/findPwd")
        Observable<ResponseBean<Map<String, String>>> editPassword(@FieldMap Map<String, String> params);

        //登出
        @GET("https://api.900sui.cn/v1/u/user/loginOut")
        Observable<ResponseBean<Map<String, String>>> logout();
    }
}